---
title: Mem0
description: Mem0Tools provides intelligent memory management capabilities for agents using the Mem0 memory platform.
---

## Example

The following agent can store and retrieve memories using Mem0:

```python
from agno.agent import Agent
from agno.tools.mem0 import Mem0Tools

agent = Agent(
    instructions=[
        "You are a memory-enhanced assistant that can remember information across conversations",
        "Store important information about users and their preferences",
        "Retrieve relevant memories to provide personalized responses",
        "Manage memory effectively to improve user experience",
    ],
    tools=[Mem0Tools(user_id="user_123")],
)

agent.print_response("Remember that I prefer vegetarian meals and I'm allergic to nuts", stream=True)
```

## Toolkit Params

| Parameter                   | Type                | Default | Description                                                    |
| --------------------------- | ------------------- | ------- | -------------------------------------------------------------- |
| `config`                    | `Optional[Dict]`    | `None`  | Mem0 configuration dictionary.                               |
| `api_key`                   | `Optional[str]`     | `None`  | Mem0 API key. Uses MEM0_API_KEY if not set.                 |
| `user_id`                   | `Optional[str]`     | `None`  | User ID for memory operations.                               |
| `org_id`                    | `Optional[str]`     | `None`  | Organization ID. Uses MEM0_ORG_ID if not set.               |
| `project_id`                | `Optional[str]`     | `None`  | Project ID. Uses MEM0_PROJECT_ID if not set.                |
| `infer`                     | `bool`              | `True`  | Enable automatic memory inference.                           |
| `enable_add_memory`         | `bool`              | `True`  | Enable memory addition functionality.                        |
| `enable_search_memory`      | `bool`              | `True`  | Enable memory search functionality.                          |
| `enable_get_all_memories`   | `bool`              | `True`  | Enable retrieving all memories functionality.                |
| `enable_delete_all_memories`| `bool`              | `True`  | Enable memory deletion functionality.                        |

## Toolkit Functions

| Function             | Description                                                      |
| -------------------- | ---------------------------------------------------------------- |
| `add_memory`         | Store new memories or information.                               |
| `search_memory`      | Search through stored memories using queries.                   |
| `get_all_memories`   | Retrieve all stored memories for the user.                      |
| `delete_all_memories`| Delete all stored memories for the user.                        |


## Developer Resources

- View [Tools Source](https://github.com/agno-agi/agno/blob/main/libs/agno/agno/tools/mem0.py)
- [Mem0 Documentation](https://docs.mem0.ai/)
- [Mem0 Platform](https://mem0.ai/)
